package com.wgu;

import com.wgu.common.utils.SpringContextHolder;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Slf4j
@EnableSwagger2 //接口文档
@SpringBootApplication
public class StoryCenterApplication extends SpringBootServletInitializer{

	public static void main(String[] args) {
		SpringApplication.run(StoryCenterApplication.class, args);
		ServerProperties serverProperties     = SpringContextHolder.getBean(ServerProperties.class);
		log.info("接口文档：====> run at http://localhost:{}/swagger-ui.html#/  <====", serverProperties.getPort() + serverProperties.getServlet().getContextPath());
	}


	/**
	 * 打war包时重写此段代码
	 * @param application
	 * @return
	 */
	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
		return application.sources(StoryCenterApplication.class);
	}
}
